package com.chanyachting.emall.action.channel;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.chanyachting.emall.domain.Channel;
import com.chanyachting.emall.form.ChannelForm;
import com.chanyachting.emall.service.ChannelService;
import com.chanyachting.emall.serviceImpl.ChannelServiceImpl;
import com.chanyachting.emall.util.DateUtil;

public class CreateAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		ChannelForm channelForm=(ChannelForm)form;
		
		Channel channel=new Channel();
		
		BeanUtils.copyProperties(channel, channelForm);
		
		channel.setCreateDate(DateUtil.getDate());
		
		ChannelService cs=new ChannelServiceImpl();
		
		cs.createChannel(channel);
		
		
		return mapping.findForward("");
	}
	
	
	

}
